<?php
$model = $this->getModel();

if(Yii::app()->getModule('sitesnippet')->canEdit())
{
	echo $this->before;
	
	if(!empty($title))
	{
		echo "<h3>{$title}</h3>\n";
	}

	$this->widget('DsJEditableWidget', array(
		'id' => 'sitesnippet_'.$snippetId,
		'model' => $model,
		'attribute' => 'text',
		'jeditable_type' => 'textarea',
		'jeditable_id' => 'id',
		'submit' => 'Save',
		'cancel' => 'Cancel',
		'rows' => '5',
		'saveurl' => CHtml::normalizeUrl(array('/sitesnippet/default/index')),
	));
	
	echo $this->after;
}
else if(!empty($model->text))
{
	echo $this->before;
	
	if(!empty($title))
	{
		echo "<h3>{$title}</h3>\n";
	}

	echo "<div id=\"sitesnippet_{$snippetId}\">{$model->text}</div>\n";
	
	echo $this->after;
}
?>